﻿// =================================================================== 
// 项目说明
//====================================================================
// lsc @Copy Right 2019
// 文件： CommentRepository.cs
// 项目名称：斑马车务
// 创建时间：2019-07-31
// 负责人：lsc
// ===================================================================
using System;
using System.Text;
using System.Collections.Generic;
using YouWei.Infrastructure.Entity;

namespace YouWei.Infrastructure.Repository
{
    /// <summary>
    /// 枚举 +
    /// </summary>
    public class CommonEnumRepository : BaseRepository<CommonEnum>
    {

        #region 构造

        public CommonEnumRepository()
            : base()
        {
        }

        public CommonEnumRepository(string connectionString)
            : base(connectionString)
        {
        }

        public CommonEnumRepository(DatabaseContext dbContext)
            : base(dbContext)
        {

        }

        #endregion

        /// <summary>
        /// 根据字段查询配置
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        public List<CommonEnum> GetCommonEnumByField(string field)
        {
            return Query("SELECT * FROM SCommonEnum WITH (NOLOCK) WHERE EnumField='" + field + "'");
        }

        public List<CommonEnum> GetCommonEnum(string field, string enumType)
        {
            return Query("SELECT * FROM SCommonEnum WITH (NOLOCK) WHERE EnumField='" + field + "' AND EnumType='" + enumType + "'");
        }

        public List<CommonEnum> GetCommonEnumByType(string enumType)
        {
            return Query("SELECT * FROM SCommonEnum WITH (NOLOCK) WHERE EnumType='" + enumType + "'");
        }
    }
}
